from fastapi import Depends 
from passlib.hash import sha256_crypt 

from model.user import User, UserInDB 
from data import user as db 
from error import Missing, Duplicate 


def create(user: UserInDB): 
    password = sha256_crypt.hash(user.hashed_password) 
    nus = user.model_copy(update={'hashed_password': password})
    return db.create(nus) 

